/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package argtrust.argsys;


import argtrust.logic.InferenceNode;

/**
 *
 * @author Yuqing Tang
 */
public class DefeatFactory  {

    public static final int PREMISE_UNDERCUT = 0;
    public static final int INTERMEDIA_UNDERCUT = 1;
    public static final int INFERENCE_UNDERCUT = 2;
    public static final int REBUT = 3;

    public static Defeat defeat(int type, 
            Argument defeater,
            Argument defeatee,
            InferenceNode defeater_inf,
            InferenceNode defeatee_inf)  {
        switch (type) {
            case PREMISE_UNDERCUT:
                return premiseUndercut(defeater, defeatee, defeater_inf, defeatee_inf);
            case INTERMEDIA_UNDERCUT:
                return intermediaUndercut(defeater, defeatee, defeater_inf, defeatee_inf);
            case INFERENCE_UNDERCUT:
                return inferenceUndercut(defeater, defeatee, defeater_inf, defeatee_inf);
            case REBUT:
                return rebut(defeater, defeatee, defeater_inf, defeatee_inf);
            default:
//                throw new edu.cuny.argtrust.basics.ArgTrustException("Not supported defeat type");
                return null;
        }
    }

    public static Defeat premiseUndercut(Argument defeater, Argument defeatee,
            InferenceNode defeater_inf, InferenceNode defeatee_inf) {
        PremiseUndercut res = new PremiseUndercut();
        res.assign(defeater, defeatee, defeater_inf, defeatee_inf);
        return res;
    }

    public static Defeat intermediaUndercut(Argument defeater, Argument defeatee,
            InferenceNode defeater_inf, InferenceNode defeatee_inf) {
        IntermediaUndercut res = new IntermediaUndercut();
        res.assign(defeater, defeatee, defeater_inf, defeatee_inf);
        return res;
    }

    public static Defeat inferenceUndercut(Argument defeater, Argument defeatee,
            InferenceNode defeater_inf, InferenceNode defeatee_inf) {
        InferenceUndercut res = new InferenceUndercut();
        res.assign(defeater, defeatee, defeater_inf, defeatee_inf);
        return res;
    }

    public static Defeat rebut(Argument defeater, Argument defeatee,
            InferenceNode defeater_inf, InferenceNode defeatee_inf) {
        Rebut res = new Rebut();
        res.assign(defeater, defeatee, defeater_inf, defeatee_inf);
        return res;
    }
}
